//
//  MathHelper.m
//  Utilities
//
//  Created by Goffredo Marocchi on 12/6/10.
//  Copyright 2010 IGGS. All rights reserved.
//

#import "MathHelper.h"


@implementation MathHelper

+ (CGFloat) lerpRangesValue:(CGFloat)value minOrigRange:(CGFloat)minLeft maxOrigRange:(CGFloat)maxLeft 
				minNewRange:(CGFloat)minRight maxNewRange:(CGFloat)maxRight {
	CGFloat leftRangeDelta = maxLeft - minLeft; //screenResolution for example
	CGFloat rightRangeDelta = maxRight - minRight; //local GL view position for example
	CGFloat scaleFactorRange = rightRangeDelta / leftRangeDelta;
	return ( ((value - minLeft)*scaleFactorRange) + minRight );
}

@end
